﻿<%@ Page Language="C#" EnableViewState="false"  AutoEventWireup="true" CodeBehind="editfile.aspx.cs" Inherits="Forum.Web.Admin.templates.editfile" %>

<%@ Register Assembly="Public.Control" Namespace="Public.Control" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
    <link href="../styles/dntmanager.css" rel="stylesheet" type="text/css" />
    <link href="../styles/colorpicker.css" rel="stylesheet" type="text/css" />

<style>
.ckall
{
 display:block; height:21px; padding-top:9px; cursor:pointer;
}
#apDiv1 {
	width:360px;
	height:278px;
	border: 2px solid #CCCCCC;
	background-color: #FFFFFF;
	display: inline;
}
.tu_title {
	text-align: center;
	background-color: #f1f1f1;
	font-weight: bold;
}
.tu_content {
	height: 255px;
	text-align: center;
	line-height: 255px;
}
.tu_content img {
	padding: 2px;
	border: 1px solid #CCCCCC;
	margin-top: 6%;
}
.index_bk_01 {
	border: 1px solid #CCCCCC;
	height: 22px;
	line-height: 22px;
}
.MainDiv ul {
	width: 100%;
	text-align: left;
}
.MainDiv li {
	float: left;
	width: 200px;
	line-height: 25px;
}
</style>
</head>
<script src="../js/public.js" type="text/javascript"></script>
<script src="../js/HBDivBox.js" type="text/javascript"></script>
    <script type="text/javascript">
        var n = 0;
        function displayHTML(obj) {
	        window.open(obj, 'popup', 'toolbar = no, status = no, scrollbars=yes');
        }	
        	
        function HighlightAll(obj) {
	        obj.focus();
	        obj.select();
	        if (document.getElementById("templatenew_posttextarea")) {
		        obj.createTextRange().execCommand("Copy");
		        window.status = '将模板内容复制到剪贴板';
		        setTimeout("window.status=''", 1800);
	        }
        }

        function findInPage(obj, str) {
        try
        {
	        var txt, i, found;
	        if (str == "") {
		        return false;
	        }
	        if (document.layers) {
		        if (!obj.find(str)) {
			        while(obj.find(str, false, true)) {
				        n++;
			        }
		        } else {
			        n++;
		        }
		        if (n == 0) {
			        alert("未找到指定字串. ");
		        }
	        }
	        if (document.getElementById("templatenew_posttextarea")) {
		        txt = obj.createTextRange();
		        for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
			        txt.moveStart('character', 1);
			        txt.moveEnd('textedit');
		        }
		        if (found) {
			        txt.moveStart('character', -1);
			        txt.findText(str);
			        txt.select();
			        txt.scrollIntoView();
			        n++;
		        } else {
			        if (n > 0) {
				        n = 0;
				        findInPage(str);
			        } else {
				        alert("未找到指定字串. ");
			        }
		        }
	        }
	        return false;
        }
        catch(error)
        {
	        alert("已经到达文件尾！");
        }
        }
        
        

    </script>
<body>
    
<form id="form1" runat="server">
<div id="apDiv1" style=" display:none;">
      <div class="tu_title">本模板缩略图</div>
      <div class="tu_content"><img  id="body_tu" src="../../WebSite_Sex/images/2008103016540785_S.jpg" width="280" height="200" /></div>
    </div>
    
<asp:Label ID="Label1" runat="server" ></asp:Label>
<div class="ManagerForm">
		<fieldset>
		    <legend style="background:url(../images/icons/icon10.jpg) no-repeat 6px 50%;">编辑模板文件 </legend>
<div class="MainDiv" style="width:90%; margin-left:auto; margin-right:auto;" >
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="50">编辑文件 - <b><%=file %></b></td>
  </tr>
  <tr>
    <td height="50">获取颜色:<cc1:ColorPicker ID="ColorPicker1" runat="server" />
                            </td>
  </tr>
  <tr>
    <td>
        <asp:TextBox runat="server"  name="templatenew_posttextarea"   
            ID="templatenew_posttextarea" onfocus="this.className='FormFocus';" 
            onblur="this.className='FormBase';"   class="FormBase" 
            style="height:410px;width:667px;" TextMode="MultiLine"></asp:TextBox>
      </td>
  </tr>
  <tr>
    <td height="50">
<input name="search" type="text" accesskey="t" size="20" onchange="n=0;" />&nbsp;
                                <button type="button" class="ManagerButton" accesskey="f" onclick="findInPage(this.form.templatenew_posttextarea, this.form.search.value)">
                                    <img src="../images/search.gif" />搜索                                </button>  
                                <button type="button" class="ManagerButton" accesskey="c" onclick="HighlightAll(this.form.templatenew_posttextarea,'')">
                                    <img src="../images/topictype.gif" />复制                                </button>  
                                
                                <button type="button" class="ManagerButton" accesskey="p" onclick="displayHTML('../../templates/<%=dir %>/<%=file %>')">
                                    <img src="../images/cache_resetall.gif" />预览                                </button></td>
  </tr>
</table>

    
        
<br />
</div>
	</fieldset>
        <div class="Navbutton" >
            <cc1:Button ID="Button1" runat="server" AutoPostBack="True" 
                ButtonImgUrl="../images/submit.gif" onclick="Button1_Click" />
&nbsp;
<button type="button" class="ManagerButton" id="Button4" onclick="window.location='edithtml.aspx?dir=<%=dir %>';" ><img src="../images/arrow_undo.gif"/> 返  回 </button>
        </div>
        </div>
</form>
</body>
</html>
